projects
/
babl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b495c13
)
babl/base: model-gray, avoid potential NaN
author
Øyvind Kolås
<pippin@gimp.org>
Thu, 14 Sep 2017 16:32:09 +0000
(18:32 +0200)
committer
Øyvind Kolås
<pippin@gimp.org>
Thu, 14 Sep 2017 16:32:23 +0000
(18:32 +0200)
babl/base/model-gray.c
patch
|
blob
|
history
diff --git
a/babl/base/model-gray.c
b/babl/base/model-gray.c
index d2cf0607805c1294661bd0d1072a91d3a9f34753..6a2764ee3df0de9e9bd4b1b695ee89935780b894 100644
(file)
--- a/
babl/base/model-gray.c
+++ b/
babl/base/model-gray.c
@@
-499,7
+499,11
@@
gray_gamma_2_2_premultiplied2rgba (Babl *conversion,
double alpha = ((double *) src)[1];
double luminance;
- luma = luma / alpha;
+ if (alpha > BABL_ALPHA_THRESHOLD)
+ luma = luma / alpha;
+ else
+ luma = 0.0;
+
luminance = babl_trc_to_linear (trc, luma);
((double *) dst)[0] = luminance;